<template>
  <div id="sports">
    <div class="mb-msg-t">
        <div class="photograph" ><img :src="expList.head_img_url"></div>
        <p class="name">{{ expList.nick_name }}</p>
        <p class="phone">{{ expList.mobile }}</p>
    </div>
    <div class="mb-list">
      <ul>
        <li class="label" v-for="item in data">
          <a @click="sportClick((title = item.title), (url = item.url))">
            <div class="icon1"><img :src="item.img"></div>
            <span class="txt">{{item.title}}</span>
          </a>
        </li>
        <!-- <li>
          <div class="icon2"><img src="../../assets/images/activ-run.png"></div>
          <router-link class="txt" to="">柠檬跑步</router-link>
        </li>
        <li>
          <div class="icon3"><img src="../../assets/images/activ-loading.png"></div>
          <router-link class="txt" to="">等待开启</router-link>
        </li>
        <li>
          <div class="icon4"><img src="../../assets/images/activ-loading.png"></div>
          <router-link class="txt" to="expense">等待开启</router-link>
        </li>
        <li>
          <div class="icon5"><img src="../../assets/images/activ-loading.png"></div>
          <router-link class="txt" to="">等待开启</router-link>
        </li> -->
      </ul>
    </div>
  </div>
</template>
<script>
  export default {
    name: 'expense',
    data () {
      return {
        expList: {},
        data: {},
        mobile: '',
        sportName: ''
      }
    },
    created () {
      this.getSports()
      this.getUserinfo()
    },
    methods: {
      sportClick (title, url) {
        window.zhuge.track('Click', {
          '事件名称': '会员中心-我要运动-项目-点击',
          'OpenID': this.getCookie('openid'),
          '姓名': this.Name,
          '时间': new Date().toLocaleString(),
          '项目名称': title
        }, () => {
          window.location.href = url
        })
      },
      getUserinfo () {
        // this.data1 = JSON.parse(localStorage.userInfo)
      // this.setCookie('openid', 'o02XP1eVG4VbbEveY4bpvqzB--uk')
      // this.setCookie('appid', 'wxd3150fe826ac186f')
        this.$axios.post(this.apidomain + '/api/cust/getFansInfoByOpenId/' + this.getCookie('appid'), {
          openId: this.getCookie('openid')
        })
        .then((response) => {
          if (response.data.errorCode === '0') {
            this.expList = response.data.data
          }
        })
        .catch((error) => {
          console.log(error)
        })
      },
      getSports () {
        this.$axios.post(this.apidomain + '/api/sportsInfo/querySportsInfo/' + this.getCookie('appid'))
        .then((response) => {
          this.data = response.data.data
          this.sportName = response.data.data.title
        })
        .catch((error) => {
          console.log(error)
        })
      }
    }
  }
</script>
<style lang="less">
  @import "../../assets/less/sports/sports.less";
</style>
